package com.bilicraft.plugin.kexue.commands;

import java.io.File;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

import com.bilicraft.plugin.kexue.ShellUser;
import com.bilicraft.plugin.kexue.utils.BBSConfig;
import com.bilicraft.plugin.kexue.utils.Download;

public class BiliCmdUpdate extends BiliCmd{
	public BiliCmdUpdate(){
		nofArgs = 0;
	}
	
	public boolean doExec(CommandSender sender, Command cmd, String label, String[] args, ShellUser shellUser){
		try{
			File fdir = new File(shellUser.curdir);
			shellUser.curdir = fdir.getCanonicalPath();
			sender.sendMessage("Updating plugin BiliBlackScience...");
			new Download(BBSConfig.udPlugin+"BiliBlackScience.jar", "./plugins/BiliBlackScience.jar", sender);
			return true;
		}catch(Exception e){
			e.printStackTrace();
		}
		return false;
	}
}
